﻿using System;
using System.Collections.Generic;

namespace duia.Canteenpay.Domain.DomainObject
{
    /// <summary>
    /// 菜品分类实体模型
    /// </summary>
    public class DishesCategory : BaseEntity
    {
        /// <summary>
        /// 菜品分类名称
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// 菜品
        /// </summary>
        public List<Dishes> Dishes { get; private set; } = new List<Dishes>();

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name"></param>
        public DishesCategory(string name)//, Guid? keyId = null
        {
            //if (keyId.HasValue) base.SetKeyId(keyId.Value);
            this.Name = !string.IsNullOrEmpty(name) ? name : throw new ArgumentNullException(nameof(name));

        }

        /// <summary>
        /// 设置菜品分类名称
        /// </summary>
        /// <param name="name"></param>
        public void SetName(string name)
        {
            this.Name = name;
        }

        /// <summary>
        /// 新增菜品
        /// </summary>
        /// <param name="dishesName"></param>
        /// <param name="dishesCode"></param>
        /// <param name="price"></param>
        /// <param name="showImageUrl"></param>
        public void AddDishes(string dishesName, string dishesCode, decimal price, string showImageUrl)
        {
            Dishes.Add(new Dishes(dishesName, dishesCode, this.KeyId, price, showImageUrl));
        }


        public void GetDishes()
        {

        }

    }
}
